home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Context / ContextUser.cp < prev    next >
Encoding:
Text File  |  1997-06-28  |  398 b   |  28 lines  |  [TEXT/CWIE]

  1. // ContextUser.cp
  2.  
  3. #ifndef ContextUser_h
  4. #include "ContextUser.h"
  5. #endif
  6. #ifndef Assert_h
  7. #include "Assert.h"
  8. #endif
  9.  
  10. ContextUser::ContextUser()
  11.   : context( Context::Current() )
  12.   {
  13.     if ( context != 0 )
  14.       {
  15.         Assert( context->users < maxuint32 );
  16.         context->users++;
  17.       }
  18.   }
  19.  
  20. ContextUser::~ContextUser()
  21.   {
  22.     if ( context != 0 )
  23.       {
  24.         Assert( context->users > 0 );
  25.         context->users--;
  26.       }
  27.   }
  28.